<template>
  <div class="mui-numbox" data-numbox-step='1' data-numbox-min='1' data-numbox-max='100'>
        <!-- "-"按钮，点击可减小当前数值 -->
        <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
        <input class="mui-numbox-input" type="number" @change="countChange" ref="numbox"/>
        <!-- "+"按钮，点击可增大当前数值 -->
        <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
</template>

<script>

import mui from '../../libs/mui/js/mui.min.js'

export default {
  components:{},
  props:{},
  data(){
    return {
    }
  },
  watch:{},
  computed:{},
  methods:{
    countChange(){
      // 每当文本框的数据修改，立即把数据通过事件调用传递给父组件
      //console.log(this.$refs.numbox.value);
      this.$emit('getCount',parseInt(this.$refs.numbox.value))
    }
  },
  created(){},
  mounted(){
    // 初始化 numberbox
    mui(".mui-numbox").numbox();
  }
}
</script>
